package com.sdhs.myproject.controller;

import com.sdhs.common.annotation.Anonymous;
import com.sdhs.common.core.controller.BaseController;
import com.sdhs.common.core.domain.AjaxResult;
import com.sdhs.common.core.page.TableDataInfo;
import com.sdhs.myproject.domain.ProjectMessage;
import com.sdhs.myproject.service.ProjectMessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/myProject/messages")
public class ProjectMessageController  extends BaseController {

    @Autowired
    private ProjectMessageService projectMessageService;

    /**
     *查询在建项目信息
     * */
    @GetMapping("/list")
    public TableDataInfo list(ProjectMessage ProjectMessage) {
         List<ProjectMessage> list = projectMessageService.getProjectMessages(ProjectMessage);
        return getDataTable(list);
    }

    /**
     *查询项目告警信息
     * */
    @GetMapping("/causeList")
    public TableDataInfo causeList(ProjectMessage ProjectMessage) {
         List<ProjectMessage> list = projectMessageService.getCauseAlarm(ProjectMessage);
        return getDataTable(list);
    }
    /**
     *  查询 项目收入和项目支出数据（未结束项目）
     *  */
    @GetMapping(value = "/getAllInfo")
    @Anonymous
    public AjaxResult getAllInfo()
    {
        return success(projectMessageService.getAllInfo());
    }

    @GetMapping(value = "/getAll")
    public AjaxResult getInfo()
    {
        return success(projectMessageService.getAll());
    }


   /**
    *  查询（在建，交工，缺陷责任期，竣工项目数据）以及总数
    *  */

   @GetMapping(value = "/getProjectAll")
   @Anonymous
   public AjaxResult getProjectAll()
   {
       return success(projectMessageService.getProjectAll());
   }
    /**
     *查询重点项目情况
     * */
    @GetMapping("/periodList")
    @Anonymous
    public AjaxResult periodList(ProjectMessage ProjectMessage) {
        List<ProjectMessage> list = projectMessageService.getPeriodList(ProjectMessage);
        return success(list);
    }


    /**
     * 收入支出项目-下钻 查询项目收入和支出项目数据
     * */
    @GetMapping("/incomeList")
    @Anonymous
    public AjaxResult incomeList(ProjectMessage ProjectMessage) {

        List<ProjectMessage> list = projectMessageService.getIncomeList(ProjectMessage);
        return success(list);
    }
}